package guava.eventbus;

import java.time.Instant;

public class TestMain {
    public static void main(String[] args) {
        EventListener1 listener1 = new EventListener1();
        EventListener2 listener2 = new EventListener2();
        CustomEvent customEvent = new CustomEvent(23);
        EventBusUtil.register(listener1);
        EventBusUtil.register(listener2);
        // 同步
        // EventBusUtil.post(customEvent);

        // 异步
        EventBusUtil.asyncPost(customEvent);
//        try {
//            Thread.sleep(10*1000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        System.out.println(Instant.now() +",主线程执行完毕："+Thread.currentThread().getName());
    }

}
